package com.hnas.trade.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.hnas.trade.dao.TradeRecordDao;
import com.hnas.trade.orm.TradeRecord;
import com.hnas.trade.service.TradeRecordService;
import com.hnas.trade.service.dto.DTOTradeRecord;

@Component("tradeRecordService")
//@Transactional(isolation=Isolation.READ_COMMITTED,readOnly=false,propagation=Propagation.REQUIRED,value="transactionManagerHnt")
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
public class TradeRecordServiceImpl implements TradeRecordService{
	
	@Autowired
	private TradeRecordDao tradeRecordDao;

	@Override
	public TradeRecord saveOrUpdate(DTOTradeRecord dto) throws Exception {
		return tradeRecordDao.saveOrUpdate(dto);
	}

	@Override
	public TradeRecord findById(String id) {
		return tradeRecordDao.find(id);
	}

	@Override
	public TradeRecord findBySwiftNumber(String swiftNumber) {
		return tradeRecordDao.findBySwiftNumber(swiftNumber);
	}

	@Override
	public List<TradeRecord> getList(String account_id, String order_parent_type, String order_type, int pageNo,
			int pageSize) {
		return tradeRecordDao.getList(account_id,order_parent_type,order_type,pageNo,pageSize);
	}

	@Override
	public List<TradeRecord> getAllByDate(String account_id, String order_parent_type, String order_type, String date) {
		return tradeRecordDao.getAllByDate(account_id, order_parent_type, order_type, date);
	}

	@Override
	public List<TradeRecord> findAllByDate(String startDate,String endDate) {
		return tradeRecordDao.findAllByDate(startDate, endDate);
	}

	@Override
	public List<String> findAllTradeSnoByDate(String startDate, String endDate) {
		return tradeRecordDao.findAllTradeSnoByDate(startDate,endDate);
	}

	@Override
	public TradeRecord findByTranSno(String tranSno) {
		return tradeRecordDao.findByTranSno(tranSno);
	}

	@Override
	public void deleteByTranSno(String tranSno) {
		tradeRecordDao.deleteByTranSno(tranSno);
	}

}
